ifneq (,)
This makefile requires GNU Make.
endif

INCLUDES = -I. -Iutil -ICluster -IObjects -IGraph
LIB_DIR  = -L/usr/lib -L/usr/local/lib
LIBS     = ${LIB_DIR} -lboost_regex
#GCC      = g++ -g ${INCLUDES}
GCC      = g++ ${INCLUDES}

VPATH = . Objects Cluster Graph util

CPP_FILES := $(wildcard *.cpp) \
             $(wildcard Objects/*.cpp) \
             $(wildcard Cluster/*.cpp) \
             $(wildcard Graph/*.cpp) \
             $(wildcard util/*.cpp)

.SUFFIXES: .h .cpp .o

all: fnf_cluster

depend: .depend
 
.depend: cmd = ${GCC} -MM -MF depend $(var); cat depend >> .depend;
.depend:
	@echo "Generating dependencies..."
	@$(foreach var, $(CPP_FILES), $(cmd))
	@rm -f depend

include .depend

OBJECTS = main.o \
      Builder_Recursive.o \
      Builder_Backtracking.o \
      Tree_Of_Clusters.o \
      Splitter.o \
      Skinner_Brute.o \
      Skinner_Cored.o \
      Skinner_Incremental.o \
      Fixer.o \
      Cluster.o \
      Gene_Metric_Object.o \
      Labeled_Metric_Object.o \
      Object_List.o \
      Point_Metric_Object.o \
      Word_Metric_Object.o \
      LMO_Span.o \
      FNF_Vertex_Info.o \
      FNF_Edge_Info.o \
      CT_Vertex_Info.o \
      CT_Edge_Info.o \
      Log.o \
      Parser.o \
      PS_Log.o \
      Postscript_Stream.o

fnf_cluster: $(OBJECTS)
	${GCC} -o fnf_cluster $(OBJECTS) ${LIBS}

$(OBJECTS): %.o: %.cpp
	${GCC} -c $<

clean:
	rm -f *.o *.exe fnf_cluster
